home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lantools
/
blueprnt
/
bpsemaph.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-10-24
|
2KB
|
62 lines
program change_server_semaphore;
(*************************************************************
* Change Semaphore on BP-LAN Server *
* by Craig Chaiken (BPSEMAPH.PAS, BPSEMAPH.EXE) * *
* October 24, 1989 *
* *
* Function: *
* This program attempts to change the specified *
* semaphore on the server, in the manner indicated by *
* the first command line parameter. If the change is *
* unsuccessful, a value of 255 is returned in the DOS *
* ERRORLEVEL Variable, which is available from any *
* batch file. *
* *
* Command Format: *
* BPSEMAPH /socket_number /semaphore_number /change *
*************************************************************)
uses dos;
{$I bppascal.inc}
var
semaphore_number:byte;
procedure change_semaphore;
{********************************}
{*** Lock Specified Semaphore ***}
{********************************}
var
temp_string:string;
begin
{*** Make Semaphore Change Request ***}
temp_string:=paramstr(3);
packet_buffer[0]:=ord(upcase(temp_string[2]));
packet_buffer[1]:=semaphore_number;
packet_length:=2;
put_packet(socket_number);
{*** Receive Success Status ***}
packet_length:=get_packet(socket_number);
{*** Exit to DOS, Setting DOS ERRORLEVEL Variable ***}
if packet_buffer[1]<>0 then
exit_with_error(255);
end;
begin
socket_number:=get_opt(1);
semaphore_number:=get_opt(2);
if ((paramstr(3)='/LOCK') or (paramstr(3)='/lock') or
(paramstr(3)='/UNLOCK') or (paramstr(3)='/unlock') or
(paramstr(3)='/CLEAR') or (paramstr(3)='/clear')) then
change_semaphore
else
begin
writeln('Syntax: BPSEMAPH /socket_number /semaphore_number ',
'/semaphore_change_switch');
writeln('''',paramstr(3),'''',
' Unsupported Semaphore Change Switch!');
writeln('Supported Switches: /LOCK, /UNLOCK, and /CLEAR')
end;
end.